<template>
	<ScaleScreen :width="1920" :height="1080" class="scale-wrap">
		<div class="bg">
			<dv-loading v-if="loading">Loading...</dv-loading>
			<div v-else class="host-body">
				<!-- 头部 s -->
				<div class="d-flex jc-center title_wrap">
					<div class="d-flex jc-center">
						<div class="title">
							<span class="title-text">
								<img
									src="./../../assets/img/logo_1.png"
									alt=""
									srcset=""
									height="40px"
									width="54px"
									@click="toBack('/lunbo')"
								/>
								能量管理系统</span
							>
						</div>
					</div>
					<div class="timers">
						<div>
							{{ dateDay }}
						</div>
						<div class="ttimers2">
							{{ dateWeek }}<br />
							{{ dateYear }}
						</div>
					</div>

					<div class="timers1">
						<el-button type="primary" @click="toBack('/energystation')"
							>进入主页</el-button
						>
					</div>
				</div>
				<!-- 头部 e-->
				<!-- 内容  s-->
				<IndexHome />
				<!-- <router-view></router-view> -->
				<!-- 内容 e -->
			</div>
		</div>
	</ScaleScreen>
	<!-- </div> -->
</template>

<script>
import { formatTime, fullscreenCheck } from "../../utils/index.js";
import ScaleScreen from "@/components/scale-screen/scale-screen.vue";
import IndexHome from "../Index/index.vue";
export default {
	components: { ScaleScreen, IndexHome },
	data() {
		return {
			timing: null,
			loading: true,
			dateDay: null,
			dateYear: null,
			dateWeek: null,
			weekday: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
		};
	},
	filters: {
		numsFilter(msg) {
			return msg || 0;
		},
	},
	computed: {},
	created() {},
	mounted() {
		this.timeFn();
		this.cancelLoading();
		// fullscreenCheck()
		// {
		//   "储能站数据-储能站日充电量 7日": "日充电量",
		//     "储能单元-间隔或储能单元出线实时有功功率 0-24": "有功功率",
		//     "储能站数据-储能站当日SOC曲线 0-24": "soc",
		//     "储能单元-箱变实时有功 0-24": "有功功率",
		//     "储能单元-PCS实时有功 0-24": "有功功率",
		//     "电池簇-Rack电池总电压曲线 0-24": "总电压",
		//     "大屏数据-实时功率 0-24": "实时功率值",
		//     "储能站数据-储能站当日有功功率曲线 0-24": "有功功率",
		//     "电池簇-RackSoc曲线 0-24": "soc",
		//     "光伏-周发电量 周": "周发电量",
		//     "大屏数据-日充电电量 7日": "日充电量",
		//     "大屏数据-日放电电量 7日": "日放电量",
		//     "储能站数据-储能站日放电量 7日": "日放电量",
		//     "电池堆-soc曲线 0-24": "soc",
		//     "光伏-实时功率曲线 0-24": "实时功率值",
		//     "光伏-月发电量 月4": "月发电量",
		//     "pcs-功率曲线 0-24": "有功功率",
		//     "储能单元-堆总电压曲线 0-24": "总电压",
		//     "光伏-日发电量曲线 0-24": "日发电量"
		//   }
	},
	beforeDestroy() {
		clearInterval(this.timing);
	},
	methods: {
		toBack(path) {
			sessionStorage.setItem("menuId", 2);

			this.$router.push({ path: path });
		},
		showSetting() {
			this.$refs.setting.init();
		},
		timeFn() {
			this.timing = setInterval(() => {
				this.dateDay = formatTime(new Date(), "HH: mm: ss");
				this.dateYear = formatTime(new Date(), "yyyy-MM-dd");
				this.dateWeek = this.weekday[new Date().getDay()];
			}, 1000);
		},
		cancelLoading() {
			let timer = setTimeout(() => {
				this.loading = false;
				clearTimeout(timer);
			}, 500);
		},
	},
};
</script>

<style lang="scss">
@import "./home.scss";
</style>
